home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / SYS / s / Count-Words.tked < prev    next >
Text File  |  1996-09-26  |  1KB  |  34 lines

  1. /** ----------------------------------------------------
  2.  ** ARexx program to count the number of words in a file 
  3.  ** ----------------------------------------------------
  4.  ** AREXX-Programm, das die Wörter eines Textes zählt
  5.  ** ----------------------------------------------------
  6.  **
  7.  ** © Tom Kroener '92
  8.  **
  9.  **/
  10.  
  11. options results
  12. address 'TKEd.1'                /* Portname of the first started TKEd */
  13. LF = '0A'X                      /* 'Linefeed' */
  14.  
  15. BeginOfFile                     /* Go to start */
  16. LastLine                        /* Get number of the last line */
  17. LastLineNr = result
  18.  
  19. Words = 0                       /* Counter for the words */
  20. LineNr = 1                      /* Counter for the lines */
  21. DO WHILE LineNr <= LastLineNr   /* Counts until it reaches the last line */
  22.   GetLine                       /* Returns the current line of the text */
  23.   Words = Words + WORDS(result) /* Add the number of words of this line */
  24.   Cursor "DOWN"                 /* Goto next line */
  25.   LineNr = LineNr + 1           /* Increment linecounter */
  26. END
  27. LineNr = LineNr - 1
  28. Request1 "Counted" Words "Words in" LineNr "Lines"
  29.                                 /* Brings up a requester with a message */
  30.                                 /* "TKED" forces the requester to 
  31.                                     appear on TKEd's screen */
  32. EXIT 0
  33.  
  34.